/*
 * $Author: isan.wong@gmail.com $
 * $Date: 2011-07-29 01:03:06 +0000 (Fri, 29 Jul 2011) $
 * $Rev: 13 $
 * $URL: http://capitalbio-smd.googlecode.com/svn/src/com/capitalbio/smd/gui/HelpDialog.java $
 */

package com.capitalbio.smd.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import javax.help.DefaultHelpModel;
import javax.help.HelpSet;
import javax.help.HelpSetException;
import javax.help.JHelp;
import javax.help.TextHelpModel;
import javax.swing.JDialog;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.capitalbio.smd.base.Util;

public class HelpDialog extends JDialog {
	private static final long serialVersionUID = 1L;
	protected Log log = LogFactory.getLog(this.getClass());
	
	public HelpDialog(Frame owner) {
		super(owner, "Help Content", true);
		
		HelpSet helpSet = null;
		ClassLoader loader = null;
		try {
			helpSet = new HelpSet(loader, Util.getResourceURL("help/smd.hs"));
		} catch (HelpSetException e) {
			log.error(e);
		}
		
		TextHelpModel helpModel = new DefaultHelpModel(helpSet);
		JHelp helpComponent = new JHelp(helpModel);
		helpComponent.setPreferredSize(new Dimension(800, 600));
		getContentPane().add(helpComponent, BorderLayout.CENTER);

		pack();
		setLocationRelativeTo(owner);
	}
}